<template>
  <div class="count">
    <h3>MyCount组件</h3>
    <button @click="changeCount">累加父组件给我的count</button>
    <button @click="addFn">查看组件实例</button>
    <p>子组件展示prop{{ count }}</p>
  </div>
</template>

<script>
export default {
  // 接收父组件传过来的函数
  props: ['count'],
  methods: {
    addFn() {
      console.log(this)
      console.log(this.count)
      console.log(this.$props.count)
    },
    changeCount(){
      this.$emit('changeCount',3 )
    }
  }
}
</script>

<style>
.count {
  background-color: rgb(191, 214, 186);
}
</style>